<?php

namespace app\dao;

use app\BaseController;
use app\Code;
use app\dao\BaseDao;

use app\model\MemberModel;
use app\validate\MemberValidate;
use think\Exception;
use think\exception\ValidateException;
use think\facade\Request;
use think\facade\Log;

class MemberDao extends BaseDao
{
    private $query;

    // 设置模型
    protected function setModel()
    {

        return MemberModel::class;
    }

    public function __construct()
    {

        $this->query = new MemberModel();
    }

    /**
     * 获取项目成员列表
     * @param int $projectId 项目ID
     */
    public function members($projectId)
    {
        return $this->query
            ->where('project_id', $projectId)
            ->select();
    }

    /**
     * 审核成员信息变更
     * @param int $id 成员ID
     */
    public function verifyInfoChange($id , $data)
    {
        return $this->query
            ->where('id', $id)
            ->update($data);
    }

    /**
     * 添加项目成员
     */
    public function addMember($data)
    {
        return $this->save($data);
    }

    /**
     * 获取成员详细信息
     * @param int $memberId 用户ID
     */
    public function getMemberById($memberId)
    {

            return $this->find($memberId);

    }



    }